package com.xht.main;

import java.util.HashMap;
import java.util.Map;



/**
 * @author xianghaitao
 * 静态工厂方法 直接调用一个类的静态方法返回一个Bean
 */
public class StaticCar {

    private	static Map<String, Car> cars = new HashMap<String,Car>();
    static {
    	cars.put("audi", new Car("audi", "shanghai", 30300));
    	cars.put("fute", new Car("fute", "beijin", 40300));
    }
    public static Car getCar (String carName){
    	return cars.get(carName);
    }
}
